Skip to content

Make test_abstract_blocktype work with MatrixAlgebraKit 0.6.6#262

Merged
mtfishman merged 6 commits intomainfrom
mf/jlarray-mak-tests-fixed
Apr 26, 2026
Merged

Make test_abstract_blocktype work with MatrixAlgebraKit 0.6.6#262
mtfishman merged 6 commits intomainfrom
mf/jlarray-mak-tests-fixed

Conversation

@mtfishman
Copy link
Copy Markdown
Member

@mtfishman mtfishman commented Apr 26, 2026

Summary

Two issues surface in test/test_abstract_blocktype.jl once MatrixAlgebraKit 0.6.6 is resolved (which can happen on any new Pkg.add/Pkg.update against the registered v0.10.39, since its test/Project.toml allows MatrixAlgebraKit = "0.6.0 - 0.6.4, 0.6.6"):

  • @test_broken f(a) for f ∈ (svd_full, svd_trunc) on JLArray-backed BlockSparseMatrix{T, AbstractMatrix{T}} errors with Expression evaluated to non-Boolean because svd_full now succeeds and returns a 3-tuple — it used to throw, which @test_broken correctly caught.
  • The unconditional @test c * u ≈ a in the right-side loop is flaky on JLArray for right_orth, lq_compact, lq_full. These factorizations regressed in MatrixAlgebraKit 0.6.5/0.6.6 and produce c * u != a on GPU-backed inputs (0.6.4 was correct), tracked upstream at Issue with LQ decomposition of JLMatrix in MatrixAlgebraKit v0.6.6 QuantumKitHub/MatrixAlgebraKit.jl#218. Whether the assertion fails on a given CI run depends on the random matrix.

This PR:

Test plan

  • Pkg.test BlockSparseArrays passes locally with MatrixAlgebraKit 0.6.6 (test_abstract_blocktype.jl: 198 pass + 54 broken = 252).
  • CI is green.

🤖 Generated with Claude Code

Two related issues surface in `test/test_abstract_blocktype.jl` once
MatrixAlgebraKit 0.6.6 is resolved:

* `@test_broken f(a)` for `f ∈ (svd_full, svd_trunc)` on JLArray-backed
  `BlockSparseMatrix{T, AbstractMatrix{T}}` errored with "Expression
  evaluated to non-Boolean" because `svd_full` now succeeds and returns
  a 3-tuple (it used to throw, which `@test_broken` correctly caught).
* The unconditional `@test c * u ≈ a` in the right-side loop was
  flaky on JLArray for `right_orth`, `lq_compact`, `lq_full` — these
  produce `c * u != a` in MatrixAlgebraKit 0.6.6 (regression from 0.6.4).

This commit:

* Seeds each `(arrayt, elt)` iteration with `StableRNG(1)` so the
  random matrices are deterministic across runs.
* Promotes `svd_full` to a regular `@test` on JLArray (it now produces
  a correct factorization).
* Wraps `svd_trunc` in a Boolean-safe `@test ... broken = true` block
  so its return value can no longer surface as a non-Boolean error.
* Marks `c * u ≈ a` as broken on JLArray for `right_orth`, `lq_compact`,
  `lq_full`, with a comment pointing at the upstream regression.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.89%. Comparing base (b912400) to head (e27e6c1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #262      +/-   ##
==========================================
- Coverage   71.99%   71.89%   -0.10%     
==========================================
  Files          36       36              
  Lines        2032     2032              
==========================================
- Hits         1463     1461       -2     
- Misses        569      571       +2     
Flag Coverage Δ
docs 5.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mtfishman and others added 5 commits April 26, 2026 15:04
Reference QuantumKitHub/MatrixAlgebraKit.jl#218 from the comment on
the broken `c * u ≈ a` assertion so the marker has a paper trail when
the upstream fix lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each independent `a` (or `a, a′`) construction gets its own
`rng = StableRNG(1234)` so individual blocks are self-contained
and reproducible in isolation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fold each `if arrayt === Array; @test ...; else @test_broken ...; end`
pair into a single `@test expr broken = (arrayt ≢ Array && ...)` form
so the array-type branching lives in the `broken` argument rather than
duplicated control flow. Drop the now-unused `@test_broken` import.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Convert the rest of the `@test_broken` calls in `test_basics.jl` and
`test_map.jl` to the `broken = ...` keyword form, fold the surviving
`if arrayt === Array; ...; else; @test_broken ...; end` pair in
`test_map.jl` into a single `@test ... broken = arrayt ≢ Array`, and
drop the now-unused `@test_broken` import from `test_genericblockindex.jl`
and `test_tensoralgebraext.jl`.

Also gate the LQ regression broken marker in `test_abstract_blocktype.jl`
on `pkgversion(MatrixAlgebraKit) < v"0.6.7"` so the marker auto-disables
once the upstream LQ gauge-fixing fix lands in MatrixAlgebraKit 0.6.7
(QuantumKitHub/MatrixAlgebraKit.jl#219).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Define the LQ-regression `broken` predicate locally and pass
`broken = broken` to `@test`, so the assertion line stays readable
without a multi-line `broken = (...)` argument.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman enabled auto-merge (squash) April 26, 2026 20:49
@mtfishman mtfishman merged commit 23b63fd into main Apr 26, 2026
18 of 19 checks passed
@mtfishman mtfishman deleted the mf/jlarray-mak-tests-fixed branch April 26, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant